home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2000 #4 / Amiga Plus CD - 2000 - No. 4.iso / Tools / Grafik / Misc / ImageEnginer / ARexx / ShiftRGB.rexx < prev    next >
Encoding:
OS/2 REXX Batch file  |  1997-01-18  |  1.8 KB  |  76 lines

  1. /* 
  2. ** $VER: ShiftRGB 3.0, IE Arexx script
  3. ** Image Engineer Macro script
  4. ** Copyright © by Patrik M Nydensten
  5. ** 14/1 1997 Stockholm/Sweden
  6. **
  7. ** Swaps/copies brightness data in the R, G and B channels.
  8. */
  9.  
  10. Options results
  11. Signal on error
  12.  
  13. if arg()==0 then exit
  14.  
  15. 'FORM "Shift RGB" "Ok|Cancel"',
  16. ' TEXT,"Swaps and/or copies image data between colour channels."',
  17. ' TEXT,"Red channel will use data from"',
  18. ' CYCLE,"Channel:","Red|Green|Blue",0',
  19. ' TEXT,"Green channel will use data from"',
  20. ' CYCLE,"Channel:","Red|Green|Blue",1',
  21. ' TEXT,"Blue channel will use data from"',
  22. ' CYCLE,"Channel:","Red|Green|Blue",2'
  23.  
  24. parse var result ok c.0 c.1 c.2
  25. if ok = 0 then exit
  26.  
  27. /* Process */
  28.  
  29. MergeImage = ''
  30.  
  31. do i = 0 to 2
  32.   if c.i = 0 then 'BRIGHTNESS' arg(1) '-255' 'GREEN BLUE'
  33.   if c.i = 1 then 'BRIGHTNESS' arg(1) '-255' 'RED BLUE'
  34.   if c.i = 2 then 'BRIGHTNESS' arg(1) '-255' 'RED GREEN'
  35.   Image = RESULT
  36.  
  37.   if (i*85-c.i*85) ~= 0 then do
  38.     'HUE' Image (i*85-c.i*85)
  39.     HueImage = RESULT
  40.     'CLOSE' Image
  41.   end
  42.   else HueImage = Image
  43.  
  44.   if MergeImage ~= '' then do
  45.     'MARK' HueImage 'PRIMARY'
  46.     'MARK' MergeImage 'SECONDARY'
  47.     'COMPOSITE' 0 0 'ADD'
  48.     Image = RESULT
  49.     'CLOSE' HueImage
  50.     'CLOSE' MergeImage
  51.     MergeImage = Image
  52.   end
  53.   else MergeImage = HueImage
  54. end
  55.  
  56. exit
  57.  
  58. /*******************************************************************/
  59. /* This is where control goes when an error code is returned by IE */
  60. /* It puts up a message saying what happened and on which line     */
  61. /*******************************************************************/
  62.  
  63. Error:
  64. if RC=5 then do
  65.     IE_TO_FRONT
  66.     LAST_ERROR
  67.     'REQUEST "'||RESULT||'"'
  68.     exit
  69. end
  70. else do
  71.     IE_TO_FRONT
  72.     LAST_ERROR
  73.     'REQUEST "Error detected!!!'||D2C(10)||'Image Engineer error message is as follows'||D2C(10)||result||D2C(10)||'Script failed on line '||SIGL||'"' ' OK '
  74.     exit
  75. end
  76.